package numberTwo;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;

public class numberTwo {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        ArrayList<Integer> list = new ArrayList();
        Class<ArrayList> arrayListClass = ArrayList.class;
        Method add = arrayListClass.getMethod("add", Object.class);
        add.invoke(list, "牛牛马马");
        System.out.println(list);

    }
}
